const express = require('express')
require('./model/connect')
const template = require('express-art-template')
const bodyParser = require('body-parser')
const dateformat = require('dateformat')
const index = require('./route/index')

const app = express()
app.use(express.static('public'))
// 当渲染后缀为art的模板时 使用express-art-template
template.template.defaults.imports.dateformat = dateformat
app.engine('art', template)
// 设置模板存放目录
app.set('views', 'views')
// 渲染模板时不写后缀 默认拼接art后缀
app.set('view engine', 'art')

app.use(bodyParser.urlencoded({ extended: false }))
app.use('/', index)

app.listen(3000)
console.log('服务器启动成功')
